<?php // @version $Id: default.php 10864 2008-08-30 07:08:04Z willebil $
defined('_JEXEC') or die('Restricted access');
?>

<?php
$uri = JFactory::getURI();
$return = $uri->toString();
$return = base64_encode($return);

if ($type == 'logout') : ?>
	<div id="login-error"></div>
	
	<?php if ($params->get('greeting')) : ?>
		<p>
			<?php if ($params->get('name')) : {
				echo JText::sprintf( 'HINAME', $user->get('name') );
			} else : {
				echo JText::sprintf( 'HINAME', $user->get('username') );
			} endif; ?>
			<br/><br/>
		</p>

	<?php endif; ?>
	<p>
	<a href="<?php echo JRoute::_( 'index.php?option=com_user&task=logout&return=' . $return); ?>">logout</a>
	</p>


<?php else : ?>
<form action="<?php echo JRoute::_( 'index.php', true, $params->get('usesecure')); ?>" method="post" name="login" class="form-login">
	<?php
	/*
	 * Niente pretext
	if ($params->get('pretext')) : ?>
	<p>
		<?php echo $params->get('pretext'); ?>
	</p>
	<?php 
	endif; 
	*/
	?>
	
	<fieldset>
	
		<div id="login-error"></div>	
		
		<p>
			<input name="username" id="mod_login_username" type="text" class="inputbox" alt="<?php echo JText::_('Username'); ?>" />
			<label for="mod_login_username">
				<?php echo strtolower(JText::_('Username')); ?>
			</label>
		</p>
		
		<p>
			<input type="password" id="mod_login_password" name="passwd" class="inputbox"  alt="<?php echo JText::_('Password'); ?>" />
			<label for="mod_login_password">
				<?php echo strtolower(JText::_('Password')); ?>
			</label>
		</p>
		
		<p>
			<button type="submit"><?php echo strtolower(JText::_('BUTTON_LOGIN')); ?></button>
		</p>
		
	</fieldset>
	
	<?php
	// Forzo remind me
	/*
	<label for="mod_login_remember" class="remember">
		<?php echo JText::_('Remember me'); ?>
	</label>
	<input type="checkbox" name="remember" id="mod_login_remember" class="checkbox" value="yes" alt="<?php echo JText::_('Remember me'); ?>" />
	*/
	?>
	
	<p>
		<a href="<?php echo JRoute::_('index.php?option=com_user&view=reset&Itemid=' . 99); ?>">
			<?php echo JText::_('FORGOT_YOUR_PASSWORD'); ?></a>
	</p>
	
	<?php
	/*
	<p>
		<a href="<?php echo JRoute::_('index.php?option=com_user&view=remind#content'); ?>">
			<?php echo JText::_('FORGOT_YOUR_USERNAME'); ?></a>
	</p>
	*/
	?>
	
	<?php $usersConfig =& JComponentHelper::getParams('com_users');
	if ($usersConfig->get('allowUserRegistration')) : ?>
	<p>
		<?php 
		//echo JText::_('No account yet?');
		// Iscrizione è a pagina id 69
		$idiscr = 69;
		$iscrizione = $mainframe -> getMenu() -> getItem($idiscr);
		?>
		<a href="<?php echo JRoute::_($iscrizione -> link . "&Itemid=" . $idiscr); ?>">
			<?php echo JText::_('Register'); ?>
		</a>
	</p>
	<?php endif;
	echo $params->get('posttext'); ?>
	<input type="hidden" name="option" value="com_user" />
	<input type="hidden" name="task" value="login" />
	<input type="hidden" name="return" value="<?php echo $return; ?>" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
<?php endif;
